package com.tllq.zhongkang.config;

import com.tllq.zhongkang.entity.ResultMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
@ControllerAdvice
public class MyExceptionHandler {
    Logger logger = LoggerFactory.getLogger(getClass());
        @ResponseBody
        @ExceptionHandler(Exception.class)
        public ResultMap errorHandler(Exception ex) {
            logger.error(ex.getMessage().substring(0,100));
            return ResultMap.error(ex.getMessage());
        }
}
